// 
// Decompiled by Procyon v0.5.36
// 

package com.orange.boot.airtemperature.service.impl;

import java.util.stream.Collector;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.orange.boot.environment.entity.EnvironmentData;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.orange.boot.airtemperature.service.EnvironmentData1Service;
import com.orange.boot.airtemperature.entity.EnvironmentData1;
import com.orange.boot.airtemperature.mapper.EnvironmentData1Mapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service("environmentData1Service")
public final class EnvironmentData1ServiceImpl extends ServiceImpl<EnvironmentData1Mapper, EnvironmentData1> implements EnvironmentData1Service
{
    @Autowired
    private EnvironmentData1Mapper environmentData1Mapper;

    public List<EnvironmentData> getEnvironmentalData(String code) {
        QueryWrapper<EnvironmentData1> queryWrapper = (QueryWrapper)((QueryWrapper)((QueryWrapper)(new QueryWrapper()).eq("code", code)).orderByDesc("gmt_create")).last("LIMIT 10");
        List<EnvironmentData1> environmentData1s = this.environmentData1Mapper.selectList(queryWrapper);
        List<EnvironmentData> dataList = (List)environmentData1s.stream().map((tar) -> {
            return new EnvironmentData(tar.getCode(), tar.getValue(), tar.getUnit(), tar.getGmtCreate());
        }).collect(Collectors.toList());
        return dataList.size() != 0 ? dataList : null;
    }
}
